package com.wfs.myapp.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

@Getter
@AllArgsConstructor
public enum BookStatusEnum {
    PENDING(0, "闲置"),
    BORROWING(1, "申请借阅中"),
    APPROVE(2, "借阅中"),
    REJECTED(3, "已拒绝"),
    EXCEEDING(4, "已逾期"),
    RETURN(5, "申请还书中"),
    DONE(6, "已完成"),
    INACTIVE(7, "隐藏"),

    ;

    private final Integer code;
    private final String msg;


    public static String getMsg(Integer code) {
        for (BookStatusEnum bookStatusEnum : BookStatusEnum.values()) {
            if (Objects.equals(bookStatusEnum.getCode(), code)) {
                return bookStatusEnum.getMsg();
            }
        }
        return "";
    }


}

